package com.tuyou.cloud.hystrix;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//@EnableCircuitBreaker //启用hystrix断路器
//@EnableDiscoveryClient
//@SpringBootApplication

@SpringCloudApplication //相当于上面三个注解组合
@EnableFeignClients
public class HystrixApplication {

    @Bean
    @LoadBalanced //Ribbon的精髓
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {

        SpringApplication.run(HystrixApplication.class, args);
    }
}
